package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.Collections;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IMessageSmsDao;
import com.financing.platform.dto.MessageSmsDTO;
import com.financing.platform.util.SqlName;


@Repository("messageSmsDaoImpl")
public class MessageSmsDaoImpl extends BaseDaoImpl implements IMessageSmsDao {

	public int addMessageSms(MessageSmsDTO messageSmsDTO) throws SQLException {
		this.sqlMapClient.insert(SqlName.addMessageSms, messageSmsDTO);
		return 1;
	}

	@SuppressWarnings("unchecked")
	public List<MessageSmsDTO> messageSmsList(MessageSmsDTO messageSmsDTO) {
		try {
			return (List<MessageSmsDTO>) this.sqlMapClient.queryForList(SqlName.queryMessageSms, messageSmsDTO);
		} catch (SQLException e) {
			log.error("Query message sms list error !", e);
			return Collections.emptyList();
		}
		
	}

	public void updateMessageSmsStatus(MessageSmsDTO messageSmsDTO)
			throws SQLException {
		this.sqlMapClient.update(SqlName.updateMessageSms, messageSmsDTO);
	}


}
